package com.bonc.apim.dao;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

import com.bonc.apim.entity.Subscribe;

/**
 * API订阅审核查询
 * 
 * @author wishes
 */
@Transactional
public interface SubscribeDao extends JpaRepository<Subscribe, Long> {

	public List<Subscribe> findByProviderNameAndApiNameAndVersionAndTierAndSubscriberAndApplicationIdAndApiApproveStatus(
			String providerName, String apiName, String version, String tier, String subscriber, String applicationId,
			int apiApproveStatus);

	public Subscribe findByProInsId(String flowInstId);

	public Subscribe findById(Long id);

	/** 分页 模糊 排序查询 */
	public Page<Subscribe> findBySubscriberAndApiNameContainingOrderByApiApproveStartTimeDesc(Pageable pageAble, String subscriber, String apiName);

	public Page<Subscribe> findBySubscriberAndApiApproveStatusAndApiNameContaining(Pageable pageAble, String subscriber,
			Integer apiApproveStatus, String apiName);

}
